package day_2022_9_to_12.Day;

import java.util.*;

/**
 * @author haomin
 * @date 2022/09/03 22:02
 **/
public class Day1_6_Offer45_MinNumber {
    class Solution {
        public String minNumber(int[] nums) {
            List<String> list = new ArrayList<>();
            for(int i : nums) list.add(Integer.toString(i));
            Collections.sort(list, (x, y) -> (x+y).compareTo(y+x));
            StringBuffer sb = new StringBuffer();
            for(int i = 0; i < list.size(); ++i) sb.append(list.get(i));
            return sb.toString();
        }
    }
}